<?php
use tpfcore\Core;
?>
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<!-- Set render engine for 360 browser -->
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<!-- HTML5 shim for IE8 support of HTML5 elements -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
			</script>
		<![endif]-->
		<link href="{$admin_assets_path}/css/theme.min.css" rel="stylesheet">
		<link href="{$admin_assets_path}/css/simplebootadmin.css" rel="stylesheet">
		<link href="{$admin_assets_path}/css/default.css" rel="stylesheet" />
		<link href="{$admin_assets_path}/css/font-awesome.min.css" rel="stylesheet" type="text/css">
		<style>
			.length_3{width: 180px;} form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
			.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;} .table-list{margin-bottom:
			0px;}
		</style>
		<!--[if IE 7]>
			<link rel="stylesheet" href="{$admin_assets_path}/css/font-awesome-ie7.min.css">
		<![endif]-->
		<script type="text/javascript">
			//全局变量
			var GV = {
				WEB_ROOT:"",
				DIMAUB: "/",
				JS_ROOT: "/theme/backend/assets/js/",
				TOKEN: ""
			};
		</script>
		<!-- Le javascript==================================================-
		-> <!-- Placed at the end of the document so the pages load faster -->
		<script src="{$admin_assets_path}/js/jquery.js"></script>
		<script src="{$admin_assets_path}/js/wind.js"></script>
		<script src="{$admin_assets_path}/js/bootstrap.min.js"></script>
		<link href="{$admin_assets_path}/kindeditor/themes/default/default.css" rel="stylesheet"/>
		<script src="{$admin_assets_path}/kindeditor/kindeditor-min.js"></script>
		<script>
			var editor;
			KindEditor.ready(function(K) {
				var uploadbutton = K.uploadbutton({
					button : K('#uploadButton')[0],
					fieldName : 'imgFile',
					url : "{:url('cms/posts/upload')}",
					afterUpload : function(data) {
						if (data.code === 0) {
							var url = K.formatUrl(data.data[0], 'absolute');
							K('#url').val(url);
							$('#show_thumb').attr('src',url).show();
						} else {
							alert(data.msg);
						}
					},
					afterError : function(str) {
						alert('错误信息已打印到控制台');
						console.log(str);
					}
					});
					uploadbutton.fileBox.change(function(e) {
					uploadbutton.submit();
				});
			});
		</script>
	</head>
	<body>
		<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="#A" data-toggle="tab">基本信息</a></li>
			<li><a href="#B" data-toggle="tab">文章内容</a></li>
			<li style="float: right;"><a href="{:url('cms/posts/index')}">文章管理</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="">
		<fieldset>
            <div class="tabbable">
                <div class="tab-content">
                	<div class="tab-pane active" id="A">
						<fieldset>
						<div class=""> 
						<table class="table table-bordered"> 
						<tbody>
						<tr> 
							<th width="80">标题</th> 
							<td> 
								<input type="text" style="width: 400px;" name="title" id="title" value="" placeholder="请输入标题"> <span class="form-required">*</span> 
							</td> 
						</tr>
						<tr>
							<th>所属分类</th> 
							<td>
								<select name="cateid">
									<option value="0">选择分类</option>
									{$categorys|default=""}
								</select>
								<span class="form-required"> *</span> 
							</td> 
						</tr>
						<tr> 
							<th width="80">标签</th> 
							<td> 
								<input type="text" style="width: 400px;" name="tag" id="tag" value="" placeholder="请输入标签，英文逗号','分隔"> <span class="form-required"> </span> 
							</td> 
						</tr>
						<tr> 
							<th width="80">缩略图</th> 
							<td> 
								<input class="ke-input-text" type="text" id="url" value="" name='thumb' readonly="readonly" /> 
								<input type="button" id="uploadButton" value="上传缩略图" />
								<img src="" style="width:50px;height:50px; display:none;" id="show_thumb"/>
								<span class="form-required"></span>
							</td> 
						</tr>  
						<tr> 
							<th>添加时间</th> 
							<td><input type="text" name="datetime" value="{:date('Y-m-d H:i',time())}" class="js-datetime date" style="width: 200px"></td> 
						</tr> 
						<tr>
							<th>文章来源</th> 
							<td><input type="text" name="source" value="{:config('config.articel_default_source')}" style="width: 200px" placeholder="文章来源"></td> 
						</tr> 
						<tr>
							<th>作者</th> 
							<td><input type="text" name="author" value="{:config('config.articel_default_author')}" style="width: 200px" placeholder="文章作者"></td> 
						</tr> 
						<tr>
							<th>浏览量</th> 
							<td>
								<input type="text" name="view" value="{:rand(10,9999)}" style="width:200px" placeholder="">
							</td> 
						</tr>
						<tr>
							<th>是否审核</th> 
							<td>
								<label>
									<input type="radio" name="ischeck" value="1" checked /> 已审核
								</label>
								<label><input type="radio" name="ischeck" value="0"/> 未审核</label>
							</td> 
						</tr>
						<tr>
							<th>是否可评论</th> 
							<td><label><input type="radio" name="iscomment" value="1" checked /> 可评论</label><label><input type="radio" name="iscomment" value="0"/> 不可评论</label></td> 
						</tr> 
						<tr>
							<th>是否置顶</th> 
							<td>
								<label><input type="radio" name="istop" value="1" /> 置顶</label><label><input type="radio" name="istop" checked value="0"/> 不置顶</label>
							</td> 
						</tr>
						<tr>
							<th>是否推荐</th> 
							<td><label><input type="radio" name="isrecommend" value="1" /> 推荐</label><label><input type="radio" name="isrecommend" value="0" checked/> 不推荐</label></td>
						</tr>
						</tbody>
						</table> 
						</div>
						</fieldset>
					</div>
					<div class="tab-pane" id="B">
						<table class="table table-bordered">
							<tr> 
							<th width="80">关键词</th> 
							<td> 
								<input type="text" style="width: 400px;" name="keywords" id="keywords" value="" placeholder="请输入关键词"> <span class="form-required"> </span> 
							</td> 
						</tr>
							<tr>
							<th>摘要</th> 
							<td>
								<textarea style="width: 700px; height:50px;" placeholder="图片集摘要，200字以内" name="abstract"></textarea>
								<span class="form-required"> 文章摘要，默认取文章内容前100长度</span>
							</td> 
						</tr>
						<tr> 
							<th>内容</th> 
							<td>
								{:Core::hook('ueditor',['name'=>'content','width'=>'100%','height'=>'','default_str'=>'','toolbars'=>''])}
							</td> 
						</tr>  
						</table>
					</div>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary js-ajax-button" type="button">确定操作</button>
				<a class="btn" href="javascript:history.back(-1);">返回</a>
			</div>
		</fieldset>
	</form>
	</div>
	<script src="{$admin_assets_path}/js/common.js"></script>
	</body>

</html>